<template>
    <div>
      <button type="button" @click="getData">获取get接口数据</button>
      <button type="button" @click="getList">获取post接口数据</button>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import { getServe, getPostData } from '../api/api.js'

const tableData = ref([])
//get
const getData = ()=>{
  getServe().then(res=>{
    console.log("data",res)
    if(res){
      tableData.value = res;
    }
  })
}
// post
const getList = ()=>{
  const data = {
    name:'123',
    age:'18'
  }
  getPostData(data).then(res=>{
    console.log("data",res)
  })
}
</script>

<style scoped>

</style>
